﻿/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-10-26 17:54:39
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-10-28 17:30:13
 * @FilePath: \WYW_0419_Oasis\JavaScripts\NPCMove.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
@MWCore.MWClass
export default class NPCMove extends MWCore.MWScript {
	NPC:GamePlay.Humanoid
	Targetlocation:Type.Vector
	/** 当脚本被实例后，会在第一帧更新前调用此函数 */
	protected onStart(): void {
		this.NPC=this.gameObject as GamePlay.Humanoid	//获得当前NPC
		this.Targetlocation=new Type.Vector(1412,2073.1,131.53)	//设定终点位置

		this.Move1()
	}

	Move1(){
		GamePlay.moveTo(this.NPC,this.Targetlocation)
		setTimeout(()=>{
			this.Targetlocation=new Type.Vector(-1990.7,585.58,131.53)
			this.Move2()
		},10000)
	}

	Move2(){
		GamePlay.moveTo(this.NPC,this.Targetlocation)
		setTimeout(()=>{
			this.Targetlocation=new Type.Vector(-4310.5,-144.6,131.53)
			this.Move3()
		},10000)
	}
	Move3(){
		GamePlay.moveTo(this.NPC,this.Targetlocation)
		setTimeout(()=>{
			this.Targetlocation=new Type.Vector(1069.83,-2621.82,131.53)
			this.Move4()
		},10000)
	}
	Move4(){
		GamePlay.moveTo(this.NPC,this.Targetlocation)
		setTimeout(()=>{
			this.Targetlocation=new Type.Vector(1412,2073.1,131.53)
			this.Move1()
		},10000)
	}
	/*@MWCore.MWFunction(MWCore.MWServer)
	Move(Targetlocation:Type.Vector){
		
	}*/

	/** 
	 * 每帧被执行,与上一帧的延迟 dt 秒
	 * 此函数执行需要将this.bUseUpdate赋值为true
	 */
	protected onUpdate(dt: number): void {

	}

	/** 脚本被销毁时最后一帧执行完调用此函数 */
	protected onDestroy(): void {

	}

}
